var AjaxRowExpander = function(config){
	Ext.apply(this, config);
    AjaxRowExpander.superclass.constructor.call(this);
}
 
Ext.extend(AjaxRowExpander, Ext.grid.RowExpander, {
    getBodyContent : function(record, index,body){
    	var that = this;
    	var p= Ext.apply(that.params);
    	if (this.extraParamsCallback){
    		p= Ext.apply(p,that.extraParamsCallback());
    	}
        p[that.AjaxIdColumn] = record.data[that.idColumn];
    	
            Ext.Ajax.request({
	           url           : this.previewURL,
	           params        : p,
	           disableCaching: true,
	           success       : function(response, options) {
	           	   var t = Ext.decode(response.responseText)
	           	   that.tpl.overwrite(body,t.data);                   
	           },
	           failure: function(error) {
	           	console.log(error);
	           }
	        });
        return Ext.UpdateManager.defaults.indicatorText;
    },
    beforeExpand : function(record, body, rowIndex){
        if(this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false){
            body.innerHTML = this.getBodyContent(record, rowIndex,body);
            return true;
        } else{
            return false;
        }
    }
});	